{
  "tasks": {
    "task": [
    {{foreach from=$tasks item=task name=fetasks}}
      {
        "id": "{{$task.id}}",
        "name": "{{$task.name}}",
        "desc": "{{$task.desc}}",
        "pid": "{{$task.pid}}",
        "dateago": "{{$task.dateago}}",
        "users": {
          "user": [
          {{foreach from=$task.users item=user name=feusers}}
            {
              "id": "{{$user.id}}",
              "name": "{{$user.name}}"
            }
            {{if $smarty.foreach.feusers.last}} {{else}},{{/if}}
      		{{/foreach}}
          ]
        }
      }
       {{if $smarty.foreach.fetasks.last}} {{else}},{{/if}}
      {{/foreach}}
    ]
  }
}